subroutine mainSP(a,i,i_time)
    dimension a(100000000),i(100000000)
    common /commonInfo/ eps2d,eps3d,radiusRED,maxiter,typeTask,nt,nMaterials,calcWK,calcVP
    common /dimTask3D/nodesCount3D,elemsCount3D,edgesCount3D,edgesTermCount3D,edgesNotTermCount3D,mTerm3d
    real*8 a,eps2d,eps3d,radiusRED
    integer typeTask,elemsCount3D,edgesCount3D,edgesTermCount3D,edgesNotTermCount3D,calcWK,calcVP,&
    vn2d_dat,vn3d_dat,va_dat,v0_dat,ax_dat,ay_dat,az_dat,a_0000,wk2d_dat,wk3d_dat
    if(typeTask.eq.0) then
        write(*,*) '    You should choose type of task for SP.'
    elseif(typeTask.eq.1)then
        call initCharacteristics(a,i,i_vertex2D,i_nVer2D,i_nInCat2D,i_points,i_numbersEl,i_params,&
        i_edges,i_nodesforedges,i_vertex3D,i_nVer3D,i_igT,i_jgT,i_ggT,i_MN)
        call calculate_characteristics(a(i_points),a(i_time),i(i_edges),i(i_nodesforedges),&
        a(i_vertex3D),i(i_nVer3D),i(i_igT),i(i_jgT),a(i_ggT),a(i_MN),a(i_vertex2D),i(i_nVer2D),&
        i(i_nInCat2D),a(i_params),i(i_numbersEl),nodesCount3D,elemsCount3D,edgesCount3D,&
        edgesTermCount3D,edgesNotTermCount3D,mTerm3d)
    else
        if(typeTask.eq.2.or.typeTask.eq.3) then
            !task2d
!            call init2d(a,i,i_vertex2D,i_nVer2D,i_nInCat2D,i_igT,i_jgT,i_ggT,i_ig,i_jg,i_ggl,i_ggu,i_di,i_f,&
!            i_v1,i_v2,i_v3,i_v4,i_v5,i_ggl2,i_ggu2,i_di2,i_Hfi,i_l1,i_numbersEl,i_params)
!            call task2d(a(i_time),a(i_vertex2D),i(i_nVer2D),i(i_nInCat2D),a(i_params),i(i_igT),&
!            i(i_jgT),a(i_ggT),i(i_ig),i(i_jg),a(i_ggu),a(i_ggl),a(i_di),a(i_f),a(i_v1),a(i_v2),i(i_numbersEl))
        endif

        if(typeTask.eq.3) then
            !task3d
            call init3d(a,i,i_vertex2D,i_nVer2D,i_nInCat2D,i_vertex3D,i_nVer3D,i_nInCat3D,&
            i_igT,i_jgT,i_ggT,i_ig,i_jg,i_ggl,i_ggu,i_di,i_f,i_l1,i_v1,i_v2,i_v3,i_v4,i_v5,&
            i_ggl2,i_ggu2,i_di2,i_vnRZ,i_vnXYZ,i_igT3D,i_jgT3D,i_ggT3D,i_l13d,i_va,i_ig3D,i_jg3D,&
            i_igEarth,i_jgEarth,i_a,i_nodesforedges,i_a0,i_params,vn2d_dat,vn3d_dat,va_dat,&
            ax_dat,ay_dat,az_dat,a_0000)
            call task3d(a(i_vertex2D),i(i_nVer2D),i(i_nInCat2D),a(i_vertex3D),a(i_params),&
            i(i_nVer3D),i(i_nInCat3D),i(i_igT),i(i_jgT),a(i_ggT),i(i_ig),i(i_jg),a(i_ggl),a(i_ggu),&
            a(i_di),a(i_f),i(i_l1),a(i_v1),a(i_v2),a(i_v3),a(i_v4),a(i_v5),a(i_ggl2),a(i_ggu2),&
            a(i_di2),a(i_vnRZ),a(i_vnXYZ),i(i_igT3D),i(i_jgT3D),a(i_ggT3D),i(i_l13d),&
            a(i_va),i(i_ig3D),i(i_jg3D),i(i_igEarth),i(i_jgEarth),a(i_a),i(i_nodesforedges),a(i_a0),&
            vn2d_dat,vn3d_dat,va_dat,ax_dat,ay_dat,az_dat,a_0000)
            !task3dV
!            call init3dNS(a,i,i_edges,i_nodesforedges,i_nInCat3D,i_igT,i_jgT,i_vertex3D,&
!            i_ggT,i_ig,i_jg,i_ggl,i_ggu,i_di,i_f,i_v1,i_v2,i_v3,i_v4,i_v5,i_a,i_nVer3D,i_E,&
!            i_l1,i_nVer2D,i_nInCat2D,i_vertex2D,i_En2D,i_hFI,i_numbersEl,i_numbersElVect,i_params,&
!            i_params2d,i_igT2D,i_jgT2D,i_ggT2D)
!            call task3dNS(a(i_di),i(i_ig),i(i_jg),a(i_ggl),a(i_ggu),a(i_v1),a(i_v2),a(i_v3),&
!            a(i_v4),a(i_v5),a(i_vertex3D),a(i_params),a(i_a),a(i_f),i(i_nInCat3D),a(i_time),&
!            i(i_igT),i(i_jgT),a(i_ggT),a(i_E),i(i_edges),i(i_nVer3D),i(i_l1),i(i_nodesforedges),&
!            i(i_nVer2D),i(i_nInCat2D),a(i_vertex2D),a(i_En2D),a(i_hFI),i(i_numbersEl),i(i_numbersElVect),&
!            a(i_params2d),i(i_igT2D),i(i_jgT2D),a(i_ggT2D))
        endif
    endif
end
!*************************************************************************
!*************************************************************************
!*************************************************************************